package com.qst.survey.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qst.survey.entity.Replay;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * @Date: 2021/3/27 11:34
 * @Description: 问题实体类
 */
public interface ReplayMapper extends BaseMapper<Replay> {
    @Select("SELECT user.age as age,replay.*,\n" +
            "       CASE\n" +
            "           WHEN sex = 0 then '女'\n" +
            "           WHEN sex = 1 then '男'\n" +
            "           END AS sex\n" +
            "FROM replay,\n" +
            "     user\n" +
            "where replay.user_id = user.id\n" +
            "  and replay.topic_id = #{topicId}")
    Page<Replay> replayList(Page page, int topicId);
}
